package com.dyz.model;

public class Koszty extends AFaktura {

	private static float sumaBrutto;
	private float cenaNetto, cenaNettodod, sumaCen, cenaBrutto,kwotaVat;

	public Koszty(String number,String data, String companyName, String adress,
			String descr, int vat, float cenaNetto, float cenaNettodod) {
		super(number,data, companyName, adress, descr, vat);
		this.cenaNetto = cenaNetto;
		this.cenaNettodod = cenaNettodod;
		sumaCen = oblSume();
		cenaBrutto = oblKwoteVat();
		sumaBrutto += cenaBrutto;
		kwotaVat = oblVat();
	}

	public static float getSumaBrutto() {
		return sumaBrutto;
	}

	private float oblSume() {
		return cenaNetto + cenaNettodod;
	}

	private float oblVat() {
		return oblSume() *vat/100;
	}
	
	private float oblKwoteVat() {
		return oblSume() *vat/100 + oblSume();
	}

	public String toString() {
		return super.toString().concat(
				String.format("%.2f  %d  %.2f  %.2f  %.2f  koszt",cenaNetto, vat, kwotaVat, cenaBrutto, cenaNettodod ));
	}
	
	public String toFormatString() {
		return super.toFormatString().concat(
				String.format("|%-10.2f| |%-10d| |%-10.2f| |%-10.2f| |%-10.2f| koszt",cenaNetto, vat, kwotaVat, cenaBrutto, cenaNettodod ));
	}

}
